package com.cosina.game.robodefence.ui.drawable;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;

import com.cosina.game.robodefence.dao.TowerDao;
import com.cosina.game.robodefence.model.Finger;
import com.cosina.game.robodefence.ui.ImageManager;
import com.cosina.game.robodefence.ui.PaintSuite;

public class FingerDrawable extends Drawable {

	@Override
	public void draw(Canvas canvas) {
		if (Finger.isBuying()) {
			Paint paint = PaintSuite.p4Bg;
			int alphaBack = paint.getAlpha();
			if (Finger.fieldCanBuilder) {
				paint.setColor(Color.CYAN);
				paint.setAlpha(60);
				canvas.drawCircle(Finger.dot.x * 40 + 20, Finger.dot.y * 40 + 20, TowerDao.getRange(Finger.kind), paint);
			} else {
				paint.setColor(Color.RED);
				paint.setAlpha(60);
				canvas.drawRect(Finger.dot.x * 40, Finger.dot.y * 40, Finger.dot.x * 40 + 40, Finger.dot.y * 40 + 40, paint);
			}
			paint.setColor(Color.BLACK);
			paint.setAlpha(alphaBack);

			ImageManager.drawTower(Finger.kind, 12, canvas, Finger.dot.x * 40, Finger.dot.y * 40);
		}else if(Finger.isUpdating()){
			Paint paint = PaintSuite.p4Bg;
			int alphaBack = paint.getAlpha();
			paint.setColor(Color.CYAN);
			paint.setAlpha(60);
			canvas.drawCircle(Finger.dot.x * 40 + 20, Finger.dot.y * 40 + 20, TowerDao.getRange(Finger.kind), paint);
			paint.setColor(Color.BLACK);
			paint.setAlpha(alphaBack);
		}
	}

	@Override
	public int getOpacity() {
		return 0;
	}

	@Override
	public void setAlpha(int alpha) {

	}

	@Override
	public void setColorFilter(ColorFilter cf) {
	}

}
